Repository navigation
fix(video360): reselect viewer when cached preload upgrades to playable - #1987
zhirongwang wants to merge 3 commits into
Conversation
A video opened from a cached entry without dash/mp4 starts in the jpg preload viewer, which MediaLoader picks as flat Dash. When file info returns dash, the preload upgrade reloaded that Dash viewer in place, so .360 videos stayed flat until a page refresh. Re-run viewer selection on the server file first and call loadViewer() when it picks a different viewer, such as Video360.
|
No actionable comments were generated in the recent review. WalkthroughThe preload upgrade path now checks which viewer handles the playable file. If no loader is available or the selected viewer differs from the preload viewer, it calls ChangesVideo preload viewer selection
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Preview
participant Loader
participant CurrentViewer
participant NewViewer
Preview->>Loader: determine viewer for playable file
alt No loader or selected viewer differs
Preview->>NewViewer: loadViewer
else Selected viewer matches current viewer
Preview->>CurrentViewer: update file and representation
Preview->>CurrentViewer: load
end
Suggested reviewers: Merge Risk:
|
a0b7fd2 to
0143213
Compare
Once the reselected viewer matches the current one, its rep is always the playable dash/mp4, so the expectedRep check and its fallback are redundant.
If no loader can play the refreshed file, call loadViewer() so it raises the account or unsupported-file error instead of a generic refresh error. Also clarify the viewer reselection comment, rename the upgrade tests, and add a test that uses the real loaders to pick Video360.
Summary
Opening a
.360video from a list where the file was preloaded showed a flat video player. After a page refresh, the same file opened in the draggable Video360 viewer.Cause
Hosts can put a file into the preview cache before it is opened. That cache entry is fetched without video rep hints, so it has the
jpgpreload rep but nodash/mp4.loadFromCachepicks a viewer from that entry.Video360Loaderrequiresdash, so it can't load the file, andMediaLoader's preload fallback picks the flatDashviewer with thejpgrep.loadFromServerreturns file info withdash.tryUpgradeVideoPreloadToPlayablechecked only whether the current viewer config (Dash) had a matching rep. It did, so the flat Dash viewer was reloaded in place. Viewer selection never ran again.After a refresh the cache is empty, so the first viewer choice already sees
dashand picks Video360.Fix
Before upgrading in place, run
loader.determineVieweron the server file with the same argumentsloadVieweruses. If that picks a different viewer (for exampleVideo360instead ofDash), callloadViewer(), which tears down the preload viewer and builds the right one.loadViewer(), as before.dash/mp4, so the oldexpectedRep/canUpgradeInPlacecheck and its fallback are removed.loadViewer()so it reports the account or unsupported-file error. Before, this threw aTypeErrorthat surfaced as a generic refresh error.X-Rep-Hintsor requests. Both viewers play the samedashrep, so this adds no conversions.Testing
*.360.mp4from the list now shows the preload image, then the Video360 viewer. A plain.mp4still upgrades in place.Summary by CodeRabbit